<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $this->title;?></title>
<link rel="stylesheet" href="<?php echo $this->baseUrl;?>/files/admin/css/main.css" />
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/jquery.js"></script>
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/load.js"></script>
<!--时间选择器-->
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/date/calendar.js"></script>
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/date/lang/cn_utf8.js"></script>
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/date/calendar-setup.js"></script>
<link rel="stylesheet" href="<?php echo $this->baseUrl;?>/files/admin/js/date/calendar-blue.css" />
<!--colorbox-->
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/colorbox.jquery/jquery.colorbox.js"></script>
<link href="<?php echo $this->baseUrl;?>/files/admin/js/colorbox.jquery/colorbox2.css" rel="stylesheet" type="text/css"/>
<style>
.subject{white-space:nowrap;}
</style>
</head>

<body>
	<div id="main">
		<div id="topMenu">
			<div id="navigation">当前位置：<a href="<?php echo $this->projectUrl(array('action'=>'index'));?>">主协议列表</a> &gt; <a href="<?php echo $this->projectUrl(array('action'=>'main-event','mainVersion'=>$this->vars['mainVersion']));?>">[<?php echo $this->vars['mainVersion'];?>]事件列表</a> &gt;<span id="focus">[<?php echo $this->vars['eventId'];?>]字段列表</span></div>
			<div id="topOtherMenu">
				<input type="button" name="insert" id="insert" value="添加字段" class="button" onclick="location.href='<?php echo $this->projectUrl(array('action'=>'main-event-field-insert','mainVersion'=>$this->vars['mainVersion'],'eventId'=>$this->vars['eventId'], 'backUrl'=>urlencode($this->pageUrl)));?>';" />
			</div>
		</div>
		<div id="body">
			<div id="search">
			</div>
			<div id="content" style="padding-top:5px;">
				<form id="listForm" name="listForm" method="post" action="">
					<table class="table">
						<tr class="subject">
							<td width="5%" class="checkBoxTd">选择</td>
							<td>版本号</td>
							<td>事件ID</td>
							<td>字段序号</td>
							<td>字段名称</td>
							<td>字段类型</td>
							<td>实现方式</td>
							<td>说明</td>
							<td width="10%" class="checkBoxTd">操作</td>
						</tr>
<?php foreach($this->rows as $row) {?>
						<tr class="dataLine">
							<td width="5%" class="checkBoxTd"><input type="checkbox" name="selectId[]" id="selectId<?php echo $row['id'];?>" class="selectCheckBox" value="<?php echo $row['id'];?>" /></td>
							<td><?php echo !empty($row['mainVersion']) ? $row['mainVersion'] : '&nbsp;';?></td>
							<td><?php echo !empty($row['eventId']) ? $row['eventId'] : '&nbsp;';?></td>
							<td><?php echo !empty($row['fieldSort']) ? $row['fieldSort'] : '&nbsp;';?></td>
							<td><?php echo !empty($row['fieldName']) ? $row['fieldName'] : '&nbsp;';?></td>
							<td><?php echo isset($this->fieldTypeRows[$row['fieldType']]['nameNote']) ? $this->fieldTypeRows[$row['fieldType']]['nameNote'] : '';?> (<?php echo $row['fieldType'];?>)</td>
							<td>
							<?php 
								if ($row['complyMode']==0){
									echo "SDK";
								} else if ($row['complyMode']==1){
									echo "APP";
								} else{
									echo "未知";
								}
							?>
							</td>
							<td><?php echo !empty($row['note']) ? $row['note'] : '&nbsp;';?></td>
							<td width="10%" align="left" class="checkBoxTd"><a href="<?php echo $this->projectUrl(array('action'=>'main-event-field-update', 'id'=>$row['id'],'mainVersion'=>$this->vars['mainVersion'],'eventId'=>$this->vars['eventId'], 'backUrl'=>urlencode($this->pageUrl))) ;?>">编辑</a>
							
							<?php if ($row['fieldType']=='A'||$row['fieldType']=='C'){?>
							<a href="<?php echo $this->projectUrl(array('action'=>'main-id-define', 'fieldType'=>$row['fieldType'],'mainVersion'=>$this->vars['mainVersion'], 'backUrl'=>urlencode($this->pageUrl))) ;?>">Id定义</a>
							<?php } else if ($row['fieldType']=='E'||$row['fieldType']=='N'||$row['fieldType']=='F'||$row['fieldType']=='G'){?>
							<a href="<?php echo $this->projectUrl(array('action'=>'main-field-enum', 'eventId'=>$row['eventId'],'fieldSort'=>$row['fieldSort'],'mainVersion'=>$this->vars['mainVersion'], 'backUrl'=>urlencode($this->pageUrl))) ;?>">枚举定义</a>
							<?php } else if ($row['fieldType']=='K'){?>
							<a href="<?php echo $this->projectUrl(array('action'=>'main-field-loop', 'eventId'=>$row['eventId'],'fieldSort'=>$row['fieldSort'],'mainVersion'=>$this->vars['mainVersion'], 'backUrl'=>urlencode($this->pageUrl))) ;?>">循环定义</a>
							<?php }else{?>
							&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
							<?php }?>
							</td>
						</tr>
<?php
}
?>
					</table>
<table class="controlTable">
						<tr>
							<td align="left">
								<input type="button" name="all" id="all" value="全选" class="button" onclick="$('.selectCheckBox').attr('checked', true);"/>
								<input type="button" name="cancel" id="cancel" value="取消" class="button" onclick="$('.selectCheckBox').attr('checked', false);"/>
								<input type="submit" name="delete" id="delete" value="删除选中" class="button" onclick="return del();"/>
							</td>
							 <td colspan="6" align="right" class="paginator"><?php //echo $this->pageString;?></td>
					</tr>
					</table>
				</form>
			</div>
		</div>
</div>
<script language="javascript">
function del()
{
	if (confirm('确定删除选中项吗？')){
		$('#listForm').attr('action', '<?php echo $this->projectUrl(array('action'=>'main-event-field-delete','mainVersion'=>$this->vars['mainVersion'],'eventId'=>$this->vars['eventId'],'backUrl'=>urlencode($this->pageUrl))) ;?>');
	}
	else{
		return false;
	}
}
</script>
</body>
</html>